package com.mengxuegu.controller;

import com.mengxuegu.service.ProductClientService;
import com.mengxuegu.springcloud.entities.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author william
 * @create 2021-06-21 22:24
 **/
@RestController
public class ProductController_Feign {
     @Autowired
    ProductClientService productClientService;
    @RequestMapping(value = "/consumer/product/add", method = RequestMethod.POST)
    public boolean add(@RequestBody Product product) {
        return productClientService.add(product);
    }


    @RequestMapping(value = "/consumer/product/get/{id}", method = RequestMethod.GET)
    public Product get(@PathVariable Long id) {
        return productClientService.get(id);
    }

    @RequestMapping(value = "/consumer/product/list", method = RequestMethod.GET)
    public List<Product> list() {
        return productClientService.list();
    }


}
